package com.somiz.main;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;

import org.hibernate.Session;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.util.Rotation;

import com.gest.util.ClosableTabbedPane;
import com.somiz.admin.Admin;
import com.tech.hibernate.HibernateUtil;

public class Principal extends JFrame {

	private JPanel contentPane;
	private ClosableTabbedPane tabbedPane;
	private JPanel panelInfo;
	private JTextArea T_admin;
	private JPanel panel_charte_1;

	/**
	 * Create the frame.
	 */
	public Principal() {
		setIconImage(Toolkit.getDefaultToolkit().getImage(
				Principal.class.getResource("/imageAutre/ico.png")));
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setTitle("Gestmat2013");
		setBounds(100, 15, 949, 701);

		JMenuBar menuBar = new JMenuBar();
		menuBar.setBackground(Color.WHITE);
		menuBar.setForeground(Color.ORANGE);
		setJMenuBar(menuBar);

		JMenu mnFichier = new JMenu("Fichier");
		mnFichier.setBackground(Color.WHITE);
		mnFichier.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/doc_lines_icon&24.png")));
		menuBar.add(mnFichier);

		JMenuItem mntmSauvgarderMesDonnes = new JMenuItem(
				"Sauvgarder mes donne\u00E9s");
		mntmSauvgarderMesDonnes.setBackground(Color.WHITE);
		mntmSauvgarderMesDonnes.setIcon(new ImageIcon(Principal.class
				.getResource("/images/png/Save24.png")));
		mnFichier.add(mntmSauvgarderMesDonnes);

		JMenuItem mntmRestaurerMesDonnes = new JMenuItem(
				"Restaurer mes donne\u00E9s");
		mntmRestaurerMesDonnes.setBackground(Color.WHITE);
		mntmRestaurerMesDonnes.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/sand_icon&24.png")));
		mnFichier.add(mntmRestaurerMesDonnes);
		mnFichier.addSeparator();

		JMenuItem mntmConfiguration = new JMenuItem("Configuration");
		mntmConfiguration.setBackground(Color.WHITE);
		mntmConfiguration.setIcon(new ImageIcon(Principal.class
				.getResource("/images/png/Wheel24.png")));
		mnFichier.add(mntmConfiguration);
		JMenuItem mntmMaSociet = new JMenuItem("Somiz");
		mntmMaSociet.setBackground(Color.WHITE);
		mntmMaSociet.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/case_icon&24.png")));
		mnFichier.add(mntmMaSociet);
		mnFichier.addSeparator();
		JMenuItem mntmQuitter = new JMenuItem("Quitter");
		mntmQuitter.setBackground(Color.WHITE);
		mntmQuitter.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/on-off_icon&24.png")));
		mntmQuitter.setHorizontalAlignment(SwingConstants.LEFT);
		mnFichier.add(mntmQuitter);

		JMenu mnAcueille = new JMenu("Acueille");
		mnAcueille.setBackground(Color.WHITE);
		mnAcueille.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/dashboard_icon&24.png")));
		menuBar.add(mnAcueille);

		JMenuItem mntmHome = new JMenuItem("Home");
		mntmHome.setBackground(Color.WHITE);
		mntmHome.setIcon(new ImageIcon(Principal.class
				.getResource("/images/png/Home24.png")));
		mnAcueille.add(mntmHome);

		JMenuItem mntmNewMenuItem = new JMenuItem("Journal");
		mntmNewMenuItem.setBackground(Color.WHITE);
		mntmNewMenuItem.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/align_center_icon&24.png")));
		mnAcueille.add(mntmNewMenuItem);

		JMenuItem mntmAssistantDappro = new JMenuItem("Assistant d'appro.");
		mntmAssistantDappro.setBackground(Color.WHITE);
		mntmAssistantDappro.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/bell_icon&24.png")));
		mnAcueille.add(mntmAssistantDappro);

		JMenu mnAchat = new JMenu("Edition");
		mnAchat.setBackground(Color.WHITE);
		mnAchat.setIcon(new ImageIcon(Principal.class
				.getResource("/images/png/Edit32.png")));
		menuBar.add(mnAchat);
		JMenuItem mntmCommandes = new JMenuItem("Equipements");
		mntmCommandes.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				tabbedPane.addTab(
						"Equipements",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getArticlePanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
			}
		});
		mntmCommandes.setBackground(Color.WHITE);
		mntmCommandes.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/monitor_icon&24.png")));
		mnAchat.add(mntmCommandes);

		JMenuItem mntmNouvCommande = new JMenuItem("Nouv. equipement");
		mntmNouvCommande.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getArticleForm().vider(session);
				tabbedPane.addTab(
						"Equipement",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getArticleForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvCommande.setBackground(Color.WHITE);
		mntmNouvCommande.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/monitor_icon&24.png")));
		mnAchat.add(mntmNouvCommande);
		mnAchat.addSeparator();

		JMenuItem mntmBonDeRecep = new JMenuItem("Utilisateurs");
		mntmBonDeRecep.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				tabbedPane.addTab(
						"Utilisateurs",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getUtilisateurPanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
			}
		});
		mntmBonDeRecep.setBackground(Color.WHITE);
		mntmBonDeRecep.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/user_icon&24.png")));
		mnAchat.add(mntmBonDeRecep);

		JMenuItem mntmNouvBonDe = new JMenuItem("Nouv. utilisateur");
		mntmNouvBonDe.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getUtilisateurForm().vider(session);
				tabbedPane.addTab(
						"Utilisateur",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getUtilisateurForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvBonDe.setBackground(Color.WHITE);
		mntmNouvBonDe.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/user_icon&24.png")));
		mnAchat.add(mntmNouvBonDe);
		mnAchat.addSeparator();

		JMenuItem mntmFactures = new JMenuItem("Structures");
		mntmFactures.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				tabbedPane.addTab(
						"Structures",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getStructurePanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
			}
		});
		mntmFactures.setBackground(Color.WHITE);
		mntmFactures.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/users_icon&24.png")));
		mnAchat.add(mntmFactures);

		JMenuItem mntmNouvFacture = new JMenuItem("Nouv. structure");
		mntmNouvFacture.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getStructureForm().vider();
				tabbedPane.addTab(
						"Structure",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getStructureForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvFacture.setBackground(Color.WHITE);
		mntmNouvFacture.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/users_icon&24.png")));
		mnAchat.add(mntmNouvFacture);
		mnAchat.addSeparator();

		JMenuItem mntmAvoirs = new JMenuItem("Fournisseurs");
		mntmAvoirs.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				tabbedPane.addTab(
						"Fournisseurs",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getFournisseurPanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
			}
		});
		mntmAvoirs.setBackground(Color.WHITE);
		mntmAvoirs.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/track_icon&24.png")));
		mnAchat.add(mntmAvoirs);

		JMenuItem mntmNouvAvoir = new JMenuItem("Nouv. fournisseur");
		mntmNouvAvoir.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getFournisseurForm().vider();
				tabbedPane.addTab(
						"Fournisseur",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getFournisseurForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvAvoir.setBackground(Color.WHITE);
		mntmNouvAvoir.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/track_icon&24.png")));
		mnAchat.add(mntmNouvAvoir);
		mnAchat.addSeparator();

		JMenuItem mntmNouvMarque = new JMenuItem("Nouv. marque");
		mntmNouvMarque.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getMarqueForm().vider();
				tabbedPane.addTab(
						"Marque",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getMarqueForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvMarque.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/bookmark_1_icon&32.png")));
		mnAchat.add(mntmNouvMarque);

		JMenuItem mntmNouvFamille = new JMenuItem("Nouv. famille");
		mntmNouvFamille.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getFamilleForm().vider();
				tabbedPane.addTab(
						"Famille",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getFamilleForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvFamille.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/bookmark_1_icon&32.png")));
		mnAchat.add(mntmNouvFamille);

		JMenuItem mntmNouvGamme = new JMenuItem("Nouv. gamme");
		mntmNouvGamme.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getGammeForm().vider();
				tabbedPane.addTab(
						"Gamme",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getGammeForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvGamme.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/bookmark_1_icon&32.png")));
		mnAchat.add(mntmNouvGamme);

		JMenu mnVente = new JMenu("Mouvement");
		mnVente.setBackground(Color.WHITE);
		mnVente.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/arrow_two_head_2_icon&32.png")));
		menuBar.add(mnVente);

		JMenuItem mntmClients = new JMenuItem("Affectations");
		mntmClients.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				tabbedPane.addTab(
						"Affectations",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getAffectationPanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
			}
		});
		mntmClients.setBackground(Color.WHITE);
		mntmClients.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/arrow_right_icon&24.png")));
		mnVente.add(mntmClients);

		JMenuItem mntmNouvClient = new JMenuItem("Nouv. affectation");
		mntmNouvClient.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getAffectationForm().vider(session);
				tabbedPane.addTab(
						"Affectation",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getAffectationForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvClient.setBackground(Color.WHITE);
		mntmNouvClient.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/arrow_right_icon&24.png")));
		mnVente.add(mntmNouvClient);
		mnVente.addSeparator();
		JMenuItem mntmDevis = new JMenuItem("Reformes");
		mntmDevis.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				tabbedPane.addTab(
						"Reformes",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getReformePanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
			}
		});
		mntmDevis.setBackground(Color.WHITE);
		mntmDevis.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/arrow_left_icon&24.png")));
		mnVente.add(mntmDevis);

		JMenuItem mntmNouvDevis = new JMenuItem("Nouv. reformes");
		mntmNouvDevis.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getReformeForm().vider(session);
				tabbedPane.addTab(
						"Reforme",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getReformeForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmNouvDevis.setBackground(Color.WHITE);
		mntmNouvDevis.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/arrow_left_icon&24.png")));
		mnVente.add(mntmNouvDevis);

		JMenu mnStock = new JMenu("Reparation");
		mnStock.setBackground(Color.WHITE);
		mnStock.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/wrench_plus_2_icon&32.png")));
		menuBar.add(mnStock);

		JMenuItem mntmProduits = new JMenuItem("Reparations");
		mntmProduits.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getReparationPanListe().viderFiltres(session);
				// Control.getReparationPanListe().actualisationFiltre(session);
				tabbedPane.addTab(
						"Reparations",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getReparationPanListe(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();
			}
		});
		mntmProduits.setBackground(Color.WHITE);
		mntmProduits.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/wrench_icon&24.png")));
		mnStock.add(mntmProduits);

		JMenuItem mntmNouvProduit = new JMenuItem("Nouv. reparation");
		mntmNouvProduit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.getReparationForm().vider(session);
				tabbedPane.addTab(
						"Reparation",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getReparationForm(), null);
				tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
				session.close();

			}
		});
		mntmNouvProduit.setBackground(Color.WHITE);
		mntmNouvProduit.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/wrench_icon&24.png")));
		mnStock.add(mntmNouvProduit);

		JMenu mnAchat_1 = new JMenu("Achat");
		mnAchat_1.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/shop_cart_icon&32.png")));
		mnAchat_1.setBackground(Color.WHITE);
		menuBar.add(mnAchat_1);

		JMenuItem mntmBientot = new JMenuItem("Bientot");
		mntmBientot.setBackground(Color.WHITE);
		mnAchat_1.add(mntmBientot);

		JMenu mnAPropos = new JMenu("A propos");
		mnAPropos.setBackground(Color.WHITE);
		mnAPropos.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/info_icon&16.png")));
		menuBar.add(mnAPropos);

		JMenuItem mntmAide = new JMenuItem("Aide");
		mntmAide.setBackground(Color.WHITE);
		mntmAide.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/globe_1_icon&24.png")));
		mnAPropos.add(mntmAide);

		JMenuItem mntmNous = new JMenuItem("On est qui ");
		mntmNous.setBackground(Color.WHITE);
		mntmNous.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/bookmark_2_icon&24.png")));
		mnAPropos.add(mntmNous);

		JMenuItem mntmMiseAJour = new JMenuItem("Mise a jour");
		mntmMiseAJour.setBackground(Color.WHITE);
		mntmMiseAJour.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/air_signal_icon&24.png")));
		mnAPropos.add(mntmMiseAJour);

		JPanel panel_1 = new JPanel();
		panel_1.setBackground(Color.WHITE);
		menuBar.add(panel_1);
		panel_1.setLayout(null);

		T_admin = new JTextArea();
		T_admin.setEnabled(false);
		T_admin.setPreferredSize(new Dimension(0, 24));
		T_admin.setBorder(new LineBorder(new Color(0, 0, 0)));
		T_admin.setBounds(10, 5, 158, 22);
		panel_1.add(T_admin);

		JButton button = new JButton("");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Admin admin = new Admin();
				Control.getAdminForm().vider();
				admin = Control.getAdminDao().TrouverAvecId(
						Control.getAdminId(), admin, session);
				Control.getAdminForm().AdminVersForm(admin);
				Control.getAdminForm().setIdAdmin(admin.getId());
				tabbedPane.addTab(
						"Compte",
						new ImageIcon(Principal.class
								.getResource("/cc/black/png/cert_icon&16.png")),
						Control.getAdminForm(), null);
				session.close();
			}
		});
		button.setPreferredSize(new Dimension(0, 24));
		button.setBackground(Color.WHITE);
		button.setIcon(new ImageIcon(Principal.class
				.getResource("/images/png/Edit16.png")));
		button.setBounds(178, 5, 22, 22);
		panel_1.add(button);

		JButton button_1 = new JButton("");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Session session = HibernateUtil.getSessionFactory()
						.openSession();
				Control.setAdminId(null);
				Control.getPrincipal().setVisible(false);
				Control.getAdminFenLogger().vider(session);
				Control.getAdminFenLogger().setVisible(true);
				session.close();
			}
		});
		button_1.setPreferredSize(new Dimension(0, 24));
		button_1.setBackground(Color.WHITE);
		button_1.setIcon(new ImageIcon(Principal.class
				.getResource("/cc/black/png/on-off_icon&16.png")));
		button_1.setBounds(203, 4, 22, 23);
		panel_1.add(button_1);
		contentPane = new JPanel();
		contentPane.setBackground(Color.WHITE);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		tabbedPane = new ClosableTabbedPane();
		tabbedPane.setBounds(10, 11, 913, 561);
		contentPane.add(tabbedPane);

		JPanel panel = new JPanel();
		panel.setBackground(Color.WHITE);
		tabbedPane.addTab(
				"Acueille",
				new ImageIcon(Principal.class
						.getResource("/cc/black/png/home_icon&24.png")), panel,
				null);
		panel.setLayout(null);

		panel_charte_1 = new JPanel();
		panel_charte_1.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_charte_1.setBounds(10, 11, 431, 501);
		panel.add(panel_charte_1);

		JPanel panel_3 = new JPanel();
		panel_3.setBorder(new LineBorder(new Color(0, 0, 0)));
		panel_3.setBounds(467, 11, 431, 501);
		panel.add(panel_3);
		tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
		panelInfo = new JPanel();
		panelInfo.setForeground(Color.BLUE);
		panelInfo.setBackground(Color.WHITE);
		panelInfo.setBorder(new LineBorder(new Color(0, 0, 0)));
		panelInfo.setBounds(10, 583, 913, 31);
		panel_charte_1.setLayout(null);
		ChartPanel chartPanel = ChartPanelFamilleMateriel();
		chartPanel.setSize(400, 250);
		panel_charte_1.add(chartPanel);
		contentPane.add(panelInfo);
	}

	private void addTabbedPane() {
		tabbedPane = new ClosableTabbedPane() {
			public boolean tabAboutToClose(int tabIndex) {
				String tab = tabbedPane.getTabTitleAt(tabIndex);
				int choice = JOptionPane.showConfirmDialog(null,
						"Voulez vous vraiment qutter cette page '" + tab
								+ "'\nQue voulez vous faire?", "Confirmation",
						JOptionPane.INFORMATION_MESSAGE);
				return choice == 0; // if returned false tab closing will be
									// canceled
			}
		};
		getContentPane().add(tabbedPane);
	}

	public ChartPanel ChartPanelFamilleMateriel() {
		DefaultPieDataset dataset = new DefaultPieDataset();
		dataset.setValue("Linux", 29);
		dataset.setValue("Mac", 20);
		dataset.setValue("Windows", 51);

		JFreeChart chart = ChartFactory.createPieChart3D("Titre a refaire",
				dataset, true, true, false);
		PiePlot3D plot = (PiePlot3D) chart.getPlot();
		plot.setStartAngle(30);
		plot.setDirection(Rotation.CLOCKWISE);
		plot.setForegroundAlpha(0.8f);

		ChartPanel chartPanel = new ChartPanel(chart);
		chartPanel.setBounds(10, 11, 431, 250);
		chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
		return chartPanel;
	}

	public JTextArea getT_admin() {
		return T_admin;
	}

	public void setT_admin(JTextArea t_admin) {
		T_admin = t_admin;
	}

	public void EcrireDessous(String string) {
		panelInfo.add(new JLabel(string));
	}

	public ClosableTabbedPane getTabbedPane() {
		return tabbedPane;
	}
}
